const frequecy = {
    props: ["list","currentList"],
  
    template: `
    <div>      
        <div class="frequently-food flex">
            <div v-for="item in list">
                <h2 class="underline">{{item.name}}</h2>
                <div class="subitem auto">
                    <div v-for="subitem in item.subList">
                        <div><img :src="subitem.src" alt=""></div>
                        <p class="mtb10">{{subitem.text}} {{subitem.price}}（元）</p>
                        <button @click="btnClick(subitem)" class="mtb10 btn">点击添加</button>
                    </div>
                </div>
            </div>
        </div>
     
    </div>
    `,
    methods: {
        stapleClick() {
            this.$emit("staple")
        },
        mainClick() {
            this.$emit("main")
        },
        btnClick(subitem) {
            console.log(subitem);
            this.$emit("add", {text:subitem.text,price:subitem.price,nums:1})
        }
    },

}
export default frequecy